feat(sdk-core): extract isMpcV2Keycard and signEddsaMpcV2RecoveryTx into shared utils - #9449
Open
vibhavgo wants to merge 4 commits into
Open
feat(sdk-core): extract isMpcV2Keycard and signEddsaMpcV2RecoveryTx into shared utils#9449vibhavgo wants to merge 4 commits into
vibhavgo wants to merge 4 commits into
Conversation
vibhavgo
marked this pull request as draft
August 7, 2026 10:18
vibhavgo
force-pushed
the
feat/sdk-core/extract-mpcv2-recovery-helper
branch
from
August 10, 2026 05:21
1340716 to
32bab87
Compare
vibhavgo
force-pushed
the
feat/sdk-core/extract-mpcv2-recovery-helper
branch
from
August 10, 2026 05:34
32bab87 to
37ba5b1
Compare
vibhavgo
force-pushed
the
feat/sdk-core/extract-mpcv2-recovery-helper
branch
from
August 10, 2026 06:17
cba5249 to
541f899
Compare
vibhavgo
marked this pull request as ready for review
August 10, 2026 07:31
Marzooqa
reviewed
Aug 10, 2026
Marzooqa
left a comment
Contributor
There was a problem hiding this comment.
Nice consolidation — moving isMpcV2Keycard/signEddsaMpcV2RecoveryTx into sdk-core is the right call since the logic is genuinely duplicated across substrate/sol/ton (and soon ada/sui/near/iota per WCI-1276).
Two follow-up cleanup spots in abstractSubstrateCoin.ts now that the shared helpers exist — left inline.
Contributor
|
Will defer to marzooqa review |
davidkaplanbitgo
left a comment
Contributor
There was a problem hiding this comment.
unclear why a BTC review is needed. Don't have enough context
vibhavgo
force-pushed
the
feat/sdk-core/extract-mpcv2-recovery-helper
branch
3 times, most recently
from
August 10, 2026 16:36
7c1c3cc to
070b63f
Compare
dpkjnr
reviewed
Aug 10, 2026
Marzooqa
approved these changes
Aug 11, 2026
Ticket: WCI-1276 Add EddsaSigningMaterial discriminated union, isMpcV2Keycard, and signEddsaMpcV2RecoveryTx to eddsaMPCv2.ts. Replace duplicated inline implementations in abstract-substrate and sdk-coin-sol with these shared helpers. sjcl fallback retained for optional bitgo parameter. Export all new symbols from sdk-core package root. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Ticket: WCI-1276 Replace inline isMpcV2Keycard and addRecoverySignature MPCv2 block in sdk-coin-ton with shared helpers from sdk-core. Removes TonSigningMaterial local type in favour of EddsaSigningMaterial. Drop-in — no behaviour change, no test modifications. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…Keychain Ticket: WCI-1276 Address PR review comments: - Remove decryptKeychain private method; inline decryptKeychainPrivateKey at its one remaining call site (MPCv1 backup-key path) - Replace getEddsaMpcV2RecoveryKeyShares + signEddsaMpcV2Recovery split wrappers with a single signSubstrateMpcV2Recovery wrapper that delegates to signEddsaMpcV2RecoveryTx from sdk-core - Remove EDDSAUtils import (no longer referenced) - Update test stubs to target the new consolidated wrapper Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…autological test Ticket: WCI-1276 Address dpkjnr review comments: - Rename isMpcV2Keycard → getEddsaSigningMaterial (returns material, not bool) - Extract parseEddsaMpcV1Material() so isEddsaMpcV1SigningMaterial and getEddsaSigningMaterial share the JSON structure check; both now decrypt exactly once — eliminates double-decrypt on v1 keycards - sjcl fallback now works for v1 in getEddsaSigningMaterial (no longer requires bitgo for v1 path) - Strengthen getEddsaSigningMaterial v1 test: assert userPrv content and that decrypt was called exactly once - Drop tautological mismatch test in abstract-substrate (sdk-core covers it) - Update all rename sites: abstract-substrate, sdk-coin-sol, sdk-coin-ton (including ton test stubs) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
vibhavgo
force-pushed
the
feat/sdk-core/extract-mpcv2-recovery-helper
branch
from
August 11, 2026 09:15
633b8e7 to
ee6720d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Extracts shared EdDSA MPCv2 recovery helpers from duplicated coin implementations into
sdk-core, then consumes them inabstract-substrate,sdk-coin-sol, andsdk-coin-ton.New in
sdk-core/eddsaMPCv2.ts:EddsaSigningMaterial— discriminated union{ version: 'v1'; userPrv } | { version: 'v2'; encryptedUserKey }getEddsaSigningMaterial(userKey, passphrase, bitgo?)— detects v1 (JSON keycard) vs v2 (CBOR keycard), single decrypt, returns typed unionparseEddsaMpcV1Material(decrypted)— internal helper that bothisEddsaMpcV1SigningMaterialandgetEddsaSigningMaterialshare to avoid double-decrypting v1 keycardssignEddsaMpcV2RecoveryTx(params)— full MPCv2 recovery signing: decrypt key shares → validatecommonKeyChain→ MPS DSGChanges per module:
abstract-substrate: inlinesdecryptKeychain, collapses two separate wrappers into singlesignSubstrateMpcV2Recovery(protected so sinon can stub it via instance property)sdk-coin-sol: replaces localEDDSAUtils.isEddsaMpcV1SigningMaterialcalls withgetEddsaSigningMaterial, simplifiesisMpcv2SigningMaterialsdk-coin-ton: replaces local duplicate of the detection + signing flow with shared helpers, renames private method togetEddsaSigningMaterialfor consistencyKey fix: v1 keycards previously triggered two decrypts (one in
isEddsaMpcV1SigningMaterial, one to retrieveuserPrv). ExtractingparseEddsaMpcV1Materialas a shared JSON-structure check eliminates the second decrypt.Test plan
sdk-core:yarn build && yarn unit-test— coversgetEddsaSigningMaterial(v1/v2/sjcl-fallback),isEddsaMpcV1SigningMaterial, andsignEddsaMpcV2RecoveryTxabstract-substrate:yarn build(no runtime test env available) — unit tests cover MPCv1 and MPCv2 happy paths and error pathsdk-coin-sol:yarn build && yarn unit-testsdk-coin-ton:yarn build && yarn unit-testTicket: WCI-1276
🤖 Generated with Claude Code